#include <iostream>
#include <sstream>
#include <string>

#include "gtest/gtest.h"
#include "proto/kittx_message.pb.h"

using namespace std;


void GenerateMessage(dexin::message::KittXMessage *message)
{
    message->set_kitt_type(dexin::message::KittXMessage_KittType::KittXMessage_KittType_KittX);
    message->set_robot_id(1);
    message->set_robot_name("apollo kittx");
}

TEST(Proto, KittXMessage)
{
    std::stringstream ss;

    {
        dexin::message::KittXMessage message;
        GenerateMessage(& message);
        ASSERT_TRUE(message.SerializeToOstream(&ss));
    }

    {
        dexin::message::KittXMessage message_cp;
        message_cp.ParseFromIstream(&ss);
        ASSERT_EQ(message_cp.robot_name(), "apollo kittx");
    }

    google::protobuf::ShutdownProtobufLibrary();
}